import glob
import random
import shutil

file_paths = glob.glob("/home/rhq/xiangmu/datasets/kuangka/train/images/*")

random.seed(30001)
random.shuffle(file_paths)

for file_path in file_paths[:3000]:
    dst_path = file_path.replace("train", "val")

    src_label_path = file_path.replace("images", "labels").replace(".jpg", ".txt")
    dst_label_path = src_label_path.replace("train", "val")

    src_mask_path = file_path.replace("images", "masks").replace(".jpg", ".png")
    dst_mask_path = src_mask_path.replace("train", "val")

    scr_show_path = file_path.replace("images", "show")
    dst_show_path = scr_show_path.replace("train", "val")

    shutil.move(file_path, dst_path)
    shutil.move(src_label_path, dst_label_path)
    shutil.move(src_mask_path, dst_mask_path)
    shutil.move(scr_show_path, dst_show_path)